package com.huawei.appmarket.service.usercenter.userinfo.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.huawei.appmarket.service.usercenter.userinfo.bean.CountryInfo;
import com.huawei.appmarket.service.usercenter.userinfo.bean.UserInfoBean;
import com.huawei.hms.framework.network.restclient.hwhttp.route.IPRoute;
import huawei.widget.HwButton;
import java.util.List;
import o.azb;
import o.der.d;
import o.der.f;
import o.der.g;
import o.dof;
import o.emj;
import o.eqp;

public class ReceiverInfoAddViewOverSea extends ReceiverInfoAddView {
    private EditText ʻॱ;
    private EditText ˊॱ;
    private TextView ˋॱ;
    private RelativeLayout ˏॱ;
    private TextView ͺ;
    private TextView ॱˊ;
    private OnClickListener ॱˋ;
    private EditText ॱᐝ;
    private List<CountryInfo> ᐝॱ;

    public ReceiverInfoAddViewOverSea(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        ˏ();
    }

    public ReceiverInfoAddViewOverSea(Context context) {
        super(context);
        ˏ();
    }

    protected void ˏ() {
        View inflate = LayoutInflater.from(this.ˊ).inflate(g.ᐨ, this);
        azb.ˏ(inflate, d.ˊ);
        this.ˎ = (LinearLayout) inflate.findViewById(d.ˊˉ);
        this.ˋॱ = (TextView) inflate.findViewById(d.ˋʿ);
        this.ˏ = (EditText) inflate.findViewById(d.ˊᐨ);
        this.ˊॱ = (EditText) inflate.findViewById(d.ˊꜟ);
        this.ͺ = (TextView) inflate.findViewById(d.ˊˈ);
        this.ॱᐝ = (EditText) inflate.findViewById(d.ˊꜞ);
        this.ʻॱ = (EditText) inflate.findViewById(d.ˊᐧ);
        this.ॱ = (TextView) inflate.findViewById(d.ˊʾ);
        this.ˏॱ = (RelativeLayout) inflate.findViewById(d.ˊꞌ);
        ᐝॱ();
        this.ॱˊ = (TextView) inflate.findViewById(d.ꜞ);
        azb.ˋ(this.ॱˊ);
        this.ʽ = (HwButton) inflate.findViewById(d.ᐝˋ);
        this.ʽ.setEnabled(true);
        this.ˏ.setOnClickListener(this.ʼ);
        this.ͺ.setOnClickListener(this.ʼ);
        this.ॱ.setOnClickListener(this.ʼ);
        this.ˊॱ.setOnClickListener(this.ʼ);
        this.ʽ.setOnClickListener(this.ʼ);
        this.ˏॱ.setOnClickListener(this.ॱˋ);
    }

    private void ᐝॱ() {
        this.ॱˋ = new OnClickListener(this) {
            final /* synthetic */ ReceiverInfoAddViewOverSea ˋ;

            {
                this.ˋ = r1;
            }

            public void onClick(View view) {
                if (view == this.ˋ.ˏॱ) {
                    this.ˋ.ˏॱ.setFocusableInTouchMode(true);
                    this.ˋ.ˏॱ.setFocusable(true);
                    this.ˋ.ˏॱ.requestFocus();
                    if (this.ˋ.ॱॱ != null) {
                        this.ˋ.ॱॱ.aq_();
                    }
                }
            }
        };
    }

    public void setCountryInfoList(List<CountryInfo> list) {
        this.ᐝॱ = list;
    }

    protected void ʽ() {
        ॱˋ();
        ˏॱ();
        ॱˊ();
        super.ʽ();
    }

    protected void ʻ() {
        if (!dof.ˋ(this.ʻ.ᐝ())) {
            this.ͺ.setText(this.ʻ.ᐝ());
        }
    }

    protected void ʼ() {
        if (!dof.ˋ(this.ʻ.ˊ())) {
            this.ˊॱ.setText(emj.ˏ(this.ʻ.ˊ()));
            new emj(50).ॱ(this.ˊॱ, this.ˊॱ.getText().toString());
        }
    }

    private void ॱˋ() {
        String ʻ = this.ʻ.ʻ();
        String str = "";
        str = "";
        str = "";
        str = "";
        if (dof.ˋ(ʻ)) {
            ʻ = eqp.ॱ();
            if (this.ᐝॱ != null && !dof.ˋ(ʻ)) {
                str = ˏ(ʻ, this.ᐝॱ);
                if (!dof.ˋ(str)) {
                    this.ʻ.ᐝ(str);
                    this.ˋॱ.setText(eqp.ˊ(ʻ) + "  +" + str);
                    return;
                }
                return;
            }
            return;
        }
        str = ॱ(ʻ, this.ᐝॱ);
        if (!dof.ˋ(str)) {
            this.ˋॱ.setText(eqp.ˊ(str) + "  +" + ʻ);
        }
    }

    public static String ˏ(String str, List<CountryInfo> list) {
        if (str == null || list == null || list.size() == 0) {
            return null;
        }
        for (CountryInfo countryInfo : list) {
            if (str.equals(countryInfo.ˏ())) {
                return countryInfo.ॱ();
            }
        }
        return null;
    }

    public static String ॱ(String str, List<CountryInfo> list) {
        if (str == null || list == null || list.size() == 0) {
            return null;
        }
        for (CountryInfo countryInfo : list) {
            if (str.equals(countryInfo.ॱ())) {
                return countryInfo.ˏ();
            }
        }
        return null;
    }

    protected void ˏॱ() {
        if (!dof.ˋ(this.ʻ.ॱॱ())) {
            this.ॱᐝ.setText(this.ʻ.ॱॱ());
        }
    }

    protected void ॱˊ() {
        if (!dof.ˋ(this.ʻ.ʽ())) {
            this.ʻॱ.setText(this.ʻ.ʽ());
        }
    }

    public void setCountryPhone(String str) {
        this.ˋॱ.setText(str);
    }

    public String ͺ() {
        return this.ˋॱ.getText().toString();
    }

    protected boolean ˋ() {
        if (this.ʻ == null) {
            this.ʻ = new UserInfoBean();
        }
        return ˊॱ() && ˎ() && ॱॱ() && ॱˎ() && ʻॱ() && ॱᐝ() && ˊ();
    }

    protected boolean ˊॱ() {
        String charSequence = this.ˋॱ.getText().toString();
        if (dof.ˋ(charSequence)) {
            Toast.makeText(this.ˊ, f.ˆ, 0).show();
            return false;
        }
        this.ʻ.ᐝ(ˋ(charSequence));
        return true;
    }

    private String ˋ(String str) {
        String[] split = str.split("\\+");
        return split[split.length - 1];
    }

    protected boolean ॱ() {
        String charSequence = this.ͺ.getText().toString();
        if (dof.ˋ(charSequence)) {
            Toast.makeText(this.ˊ, f.ˈˊ, 0).show();
            return false;
        }
        this.ʻ.ʽ(charSequence);
        return true;
    }

    protected boolean ॱॱ() {
        String ᐝ = ᐝ();
        boolean z = !dof.ˋ(ᐝ) && 4 <= ᐝ.length() && ᐝ.length() <= 50 && emj.ˋ(ᐝ);
        if (z) {
            this.ʻ.ˎ(ᐝ);
            return true;
        }
        Toast.makeText(this.ˊ, f.ˉᐝ, 0).show();
        return false;
    }

    protected boolean ॱˎ() {
        String charSequence = this.ͺ.getText().toString();
        if (charSequence.length() <= IPRoute.INTERVAL) {
            this.ʻ.ʽ(charSequence);
            return true;
        }
        Toast.makeText(this.ˊ, f.ˉˊ, 0).show();
        return false;
    }

    protected boolean ʻॱ() {
        String obj = this.ॱᐝ.getText().toString();
        if (obj.length() <= IPRoute.INTERVAL) {
            this.ʻ.ʼ(obj);
            return true;
        }
        Toast.makeText(this.ˊ, f.ˊʾ, 0).show();
        return false;
    }

    protected boolean ॱᐝ() {
        String obj = this.ʻॱ.getText().toString();
        if (obj.length() <= 50) {
            this.ʻ.ॱॱ(obj);
            return true;
        }
        Toast.makeText(this.ˊ, f.ˊˑ, 0).show();
        return false;
    }

    public boolean ˋॱ() {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        if (this.ʻ == null) {
            str = "";
            str2 = "";
            str3 = "";
            str4 = "";
            str5 = "";
            str6 = "";
            str7 = "";
        } else {
            str = this.ʻ.ʻ();
            str2 = this.ʻ.ʼ();
            str3 = this.ʻ.ˊ();
            str4 = this.ʻ.ᐝ();
            str5 = this.ʻ.ॱॱ();
            str6 = this.ʻ.ʽ();
            str7 = this.ʻ.ˋ();
        }
        return ˎ(this.ˏ, str2) || ॱ(str4) || ˎ(this.ॱ, str7) || ˏ(ˊ(str3)) || ˎ(str) || ˎ(this.ॱᐝ, str5) || ˎ(this.ʻॱ, str6);
    }

    protected boolean ॱ(String str) {
        return ˎ(this.ͺ, str);
    }

    protected boolean ˏ(String str) {
        return ˎ(this.ˊॱ, str);
    }

    protected boolean ˎ(String str) {
        return !str.equals(ˋ(this.ˋॱ.getText().toString()));
    }

    protected String ˊ(String str) {
        return emj.ˏ(str);
    }

    protected String ᐝ() {
        if (ˎ(this.ˊॱ, ˊ(this.ʻ.ˊ()))) {
            return this.ˊॱ.getEditableText().toString();
        }
        return this.ʻ.ˊ();
    }
}
